package huzh.foundation.xml;

import java.io.Serializable;
import java.util.HashMap;

/**
 *<p>title:XmlNode</p>
 *<p>description:</p>
 * @since 2014-6-6
 * @author huzh
 * @version 1.0
 */
public class XmlNode implements Serializable{
    /**serialVersionUID*/
    private static final long serialVersionUID = 3211635068724861812L;
    /**attributeMap*/
    private HashMap<?,?> attributeMap;
    /**valueStr*/
    private String valueStr;
    /**nodeStr*/
    private String nodeStr;
    /**valueObject*/
    private Object valueObject;
    /**sequence*/
    private int sequence;

    /**
     * @return
     */
    public HashMap<?,?> getAttributeMap() {
        return this.attributeMap;
    }

    /**
     * @param attributeMap
     */
    public void setAttributeMap(HashMap<?,?> attributeMap) {
        this.attributeMap = attributeMap;
    }

    /**
     * @return valueStr
     */
    public String getValueStr() {
        return this.valueStr;
    }

    /**
     * @param valueStr
     */
    public void setValueStr(String valueStr) {
        this.valueStr = valueStr;
    }

    /**
     * @return nodeStr
     */
    public String getNodeStr() {
        return this.nodeStr;
    }

    /**
     * @param nodeStr
     */
    public void setNodeStr(String nodeStr) {
        this.nodeStr = nodeStr;
    }

    /**
     * @return valueObject
     */
    public Object getValueObject() {
        return this.valueObject;
    }

    /**
     * @param valueObject
     */
    public void setValueObject(Object valueObject) {
        this.valueObject = valueObject;
    }

    /**
     * @param name
     * @return
     */
    public String getAttribute(String name) {
        return (String)this.attributeMap.get(name);
    }

    /**
     * @return sequence
     */
    public int getSequence() {
        return this.sequence;
    }

    /**
     * @param sequence
     */
    public void setSequence(int sequence) {
        this.sequence = sequence;
    }

    /**
     * @return
     */
    @SuppressWarnings("unchecked")
    public Object clone() {
        XmlNode node = new XmlNode();
        node.setNodeStr(getNodeStr());
        node.setAttributeMap((HashMap<Object,Object>)(HashMap<Object,Object>)getAttributeMap().clone());
        node.setValueStr(getValueStr());
        node.setSequence(getSequence());
        node.setValueObject(getValueObject());
        return node;
    }

    public String toString()
    {
      return "XmlNode[sequence:" + this.sequence + ",nodeStr:" + this.nodeStr + ",valueStr:" + this.valueStr + ",valueObject:" + this.valueObject + ",attributeMap:" + this.attributeMap + "]\r\n";
    }
  }
